package com.mayisoftware.mayioa.business.human.impl.serviceImpl;

import com.mayisoftware.mayioa.business.human.api.domain.HCBoardInfo;
import com.mayisoftware.mayioa.business.human.api.domain.HCMonitorInfo;
import com.mayisoftware.mayioa.business.human.api.domain.HumanSearchInfo;
import com.mayisoftware.mayioa.business.human.api.service.IHCService;
import com.mayisoftware.mayioa.business.human.impl.dao.HCMapper;
import com.mayisoftware.mayioa.platform.api.domain.SysDictData;
import com.mayisoftware.mayioa.platform.api.service.ISysDictDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户 业务层处理
 * 
 *
 */
@Service
public class HCServiceImpl implements IHCService
{

    @Autowired
    private HCMapper hcMapper;


    @Autowired
    private ISysDictDataService dictService;



    @Override
    public List<HCBoardInfo> getHCInfoByConditions(HumanSearchInfo searchInfo)
    {
        return hcMapper.getHCByConditions(searchInfo);
    }

    @Override
    public HCBoardInfo getHCInfoById(String hcId) {
        return hcMapper.getHCInfoById(hcId);
    }

    @Override
    public int isHCMonitorExist(HCMonitorInfo monitorInfo) {
        return hcMapper.isHCMonitorExist(monitorInfo);
    }

    @Override
    public int insertHCMonitor(HCMonitorInfo monitorInfo) {
        return hcMapper.insertHCMonitor(monitorInfo);
    }

    @Override
    public int updateHCMonitor(HCMonitorInfo monitorInfo) {
        return hcMapper.updateHCMonitor(monitorInfo);
    }

    @Override
    public String getDictLabel(String dictType, String dictValue) {
        return  dictService.selectDictLabel(dictType,dictValue);
    }

    @Override
    public String getDictValue(String dictType, String dictLabel) {
        List<SysDictData> dicts = dictService.selectDictDataByType(dictType);
        for (SysDictData dict:dicts) {
            if (dict.getDictLabel().equalsIgnoreCase(dictLabel)){
                return  dict.getDictValue();
            }
        }
        return "";
    }
}
